Skip to content

test(titlebar): fix TitleBar.syncState flake from cold-transform timeout - #147

Merged
kipavy merged 1 commit into
devfrom
fix/titlebar-syncstate-flake
Aug 19, 2026
Merged

test(titlebar): fix TitleBar.syncState flake from cold-transform timeout#147
kipavy merged 1 commit into
devfrom
fix/titlebar-syncstate-flake

Conversation

@kipavy

@kipavy kipavy commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Root cause

The first test in TitleBar.syncState.test.tsx did await import("./TitleBar") inside the test body. That cold-transforms TitleBar's entire dependency graph within the test's default 5s timeout. Under load the transform alone exceeds 5s, so the first test times out while the second passes on the now-warm module cache.

Confirmed pre-existing on a pristine origin/dev checkout — not a regression, but it produces false failures in full-suite CI gates.

Fix

Hoist the import into beforeAll (given its own 20s timeout), so the cold transform is paid once outside any single test's timeout window. Both tests become synchronous and reuse the hoisted binding.

Test-only change, one file. No source files touched.

The first test imported ./TitleBar dynamically, so vitest cold-transformed
the component's whole dependency graph inside that test's 5s timeout. Under
load the transform alone exceeded it and the first test failed while the
second passed on the warm cache.

Import once in beforeAll, which carries its own timeout and is not billed
to any single test.
@kipavy
kipavy merged commit d80cdf8 into dev Aug 19, 2026
4 checks passed
@kipavy
kipavy deleted the fix/titlebar-syncstate-flake branch August 19, 2026 01:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant